package com.dx.spring6_15.configBeanMethod;

import java.util.HashMap;
import java.util.Map;

public class InstanceCarFactory {

	private static Map<String,Car> cars = null;
	
	
	// 实例工厂方法，需要先创建工厂本身，然后再调用工厂本身体的方法，来返回Bean 实例。
	
	public InstanceCarFactory(){
		
		cars = new HashMap<String,Car>();
		cars.put("audio", new Car("audio",11));
		cars.put("have", new Car("have",14));
	}
	
	public Car getCar(String name){
		
		return cars.get(name);
	}
	
}
